package StudyCode.summary.myfile;

import java.util.Arrays;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class ConvertsByteArrayInteger {
	public static void main(String[] argv) {
		byte[] b = new byte[]{34, 35, 36, 37, 37, 37, 67, 68, 69};
		System.out.println("字节数组" + Arrays.toString(b) + "转为Integer:");
		System.out.println(byteArrayToInteger(b));
	}


	private static int byteArrayToInteger(byte[] b) {
		return b[3] & 0xFF | (b[2] & 0xFF) << 8 | (b[1] & 0xFF) << 16 | (b[0] & 0xFF) << 24;
	}
}
